var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    }; Object.defineProperty(o, "__esModule", { value: !0 });
var a = (function () {
    function e() { }
    return (
        (e.getWordCount = function (e) {
            for (var t = 0, o = 0; o < e.length; ++o) this.isChWord(e.charCodeAt(o)) ? (t += 2) : ++t;
            return t;
        }),
        (e.isChWord = function (e) {
            return e > 255 || e < 0;
        }),
        (e.getRandomInt = function (e, t) {
            return Math.floor(Math.random() * (t - e + 1)) + e;
        }),
        (e.getRandom = function (e, t) {
            return e + Math.random() * (t - e);
        }),
        (e.randomStr = function (t) {
            for (var o = "", a = 0; a < t; a++) {
                var n = e.getRandomInt(0, 35);
                o += n <= 9 ? n : String.fromCharCode("a".charCodeAt(0) + n - 10);
            }
            return o;
        }),
        (e.fixNumByZero = function (e, t) {
            for (var o = e.toString(), a = o.length; a < t; a++) o = "0" + o;
            return o;
        }),
        (e.getCommaNumString = function (t, o, a) {
            void 0 === o && (o = 3), void 0 === a && (a = ",");
            var n = t >= 0;
            t = t >= 0 ? t : -t;
            for (var i = 1, r = 0; r < o; r++) i *= 10;
            var s = [];
            do {
                s.push(t % i), (t = Math.floor(t / i));
            } while (t > 0);
            for (var l = n ? "" : "-", _ = s.length - 1; _ >= 0; _--)
                _ == s.length - 1 ? (l += s[_]) : (l += a + e.fixNumByZero(s[_], o));
            return l;
        }),
        (e.convertStrEllipsis = function (e, t, o) {
            void 0 === o && (o = "...");
            for (var a = 0, n = e, i = 0; i < e.length; ++i) {
                if (a >= t) {
                    n = e.slice(0, a) + o;
                    break;
                }
                this.isChWord(e.charCodeAt(i)) ? (a += 2) : ++a;
            }
            return n;
        }),
        (e.getTimeStrByNum = function (e, t, o) {
            void 0 === t && (t = !1);
            var a = parseInt("" + (e % 864e5) / 36e5),
                n = parseInt("" + (e % 36e5) / 6e4),
                i = (e % 6e4) / 1e3,
                r = "";
            return (
                1 == o
                    ? (a > 0 && (r = a + (t ? "小时" : ":")),
                        n > 0 && (r += n + (t ? "分钟" : ":")),
                        i > 0 && ((r += parseInt("" + i)), (r += t ? "秒" : "")))
                    : 2 == o &&
                    (n > 0 ? ((r += n < 10 ? "0" + parseInt("" + n) : parseInt("" + n)), (r += ":")) : (r += "00:"),
                        (r += i > 0 ? (i < 10 ? "0" + parseInt("" + i) : parseInt("" + i)) : "00")),
                r
            );
        }),
        (e.getBtnNameType = function (e, t) {
            var o = e.target.name;
            return this.getNameType(o, t);
        }),
        (e.getNameType = function (e, t) {
            var o = t.length;
            return e.substr(o, e.length - o);
        }),
        (e.getCoinByString = function (e) {
            var t = "";
            if (e > 9999) {
                var o = Math.floor(e / 1e4),
                    a = Math.floor((e % 1e4) / 100);
                t = o + "." + (a < 10 ? "0" + a : a + "") + "w";
            } else t = "" + e;
            return t;
        }),
        (e.lerp = function (e, t, o) {
            return e + (t - e) * o;
        }),
        (e.saveJSON = function (e, t) {
            if (e) {
                t || (t = "json.json"), "object" == typeof e && (e = JSON.stringify(e, void 0, 4));
                var o = new Blob([e], { type: "text/json" }),
                    a = document.createEvent("MouseEvents"),
                    n = document.createElement("a");
                (n.download = t),
                    (n.href = window.URL.createObjectURL(o)),
                    (n.dataset.downloadurl = ["text/json", n.download, n.href].join(":")),
                    a.initMouseEvent("click", !0, !1, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null),
                    n.dispatchEvent(a);
            } else alert("保存的数据为空");
        }),
        e
    );
})();
o.default = a;
